//---------------------------------------------------------------------------


#include <map>

#include "stdafx.h"
#include "VlcCfg.h"


//---------------------------------------------------------------------------

#pragma package(smart_init)


VlcCfg::VlcCfg()
{
  m_param_list.empty();
}

VlcCfg::~VlcCfg()
{}


void VlcCfg::AddParam(UnicodeString uszParam, UnicodeString uszValue)
{
   assert(uszParam.IsEmpty());
   m_param_list.insert(pair<UnicodeString, UnicodeString>(uszParam, uszValue));
}


int VlcCfg::GetCount()
{
   return m_param_list.size();
}

bool VlcCfg::GetDataByIndex(int idx, UnicodeString Param, UnicodeString Value)
{
   map<UnicodeString, UnicodeString>::iterator param_list_iter;
   UnicodeString LocalParam;
   UnicodeString LocalValue;

   int curr_idx=0;
   for(param_list_iter=m_param_list.begin(); param_list_iter != m_param_list.end(); ++param_list_iter)
   {
     if ((curr_idx++) == idx)
     {
        LocalParam = param_list_iter->first;
        LocalValue = param_list_iter->second;
        Param = LocalParam;
        Value = LocalValue;
        return true;
     }
   }
   return false;
}



void VlcCfg::AddVlcCfg(VlcCfg *pvlc_cfg)
{
   assert(pvlc_cfg);

   int inc_count = pvlc_cfg->GetCount();
   int i=0;
   UnicodeString LocalParam;
   UnicodeString LocalValue;
   for (i; i<inc_count;i++)
   {
      if (GetDataByIndex(i, LocalParam, LocalValue))
         m_param_list.insert(pair<UnicodeString, UnicodeString>(LocalParam, LocalValue));
   }
}

UnicodeString VlcCfg::GetValue(UnicodeString uszParam)
{
   assert(uszParam.IsEmpty());
   return m_param_list[uszParam];
}
